package com.haoshuang.zhouzhoubang.ui.dialog

import android.content.Context
import android.widget.LinearLayout


import android.widget.TextView
import androidx.constraintlayout.widget.ConstraintLayout
import androidx.recyclerview.widget.LinearLayoutManager
import androidx.recyclerview.widget.RecyclerView
import com.google.android.flexbox.FlexDirection
import com.google.android.flexbox.FlexWrap
import com.google.android.flexbox.FlexboxLayoutManager
import com.google.android.flexbox.JustifyContent
import com.haoshuang.zhouzhoubang.R
import com.haoshuang.zhouzhoubang.model.bean.ReturnBean
import com.haoshuang.zhouzhoubang.ui.page.order.assignment.ServiceLabelAdapter

import com.lxj.xpopup.core.BottomPopupView



class BjDialog3(context: Context, list2:ArrayList<String>, private val onSubmit: (str: ReturnBean) -> Unit) : BottomPopupView(context){
    override fun getImplLayoutId(): Int = R.layout.dialog_list2
    var list=list2
    var context2=context
    override fun initPopupContent() {
        super.initPopupContent()

        var adapter= ServiceLabelAdapter(list)
        var tvGb2=findViewById<TextView>(R.id.gb)
        var tvGl=findViewById<ConstraintLayout>(R.id.tvGl)
        var rvList=findViewById<RecyclerView>(R.id.rvList)
         val flexboxLayoutManager = FlexboxLayoutManager(context)
                flexboxLayoutManager.apply {
                    flexDirection = FlexDirection.ROW
                    flexWrap = FlexWrap.WRAP   //按正常方向换行
                    justifyContent = JustifyContent.FLEX_START //交叉轴的起点对齐。
                }
        rvList.layoutManager=flexboxLayoutManager
        rvList.adapter=adapter
        adapter.setOnItemClickListener { adapter, view, position ->
            dismiss()
        }
        tvGl.setOnClickListener {
            dismiss()
        }
        tvGb2.setOnClickListener {
            dismiss()
        }

    }


}